function createEditorConfig() {
  const componentList = [];
  const componentMap = {};
  return {
    componentList,
    componentMap,
    register: (component) => {
      componentList.push(component);
      componentMap[component.key] = component;
    },
  };
}

export let registerConfig = createEditorConfig();

// 左侧使用预览preview，中间控制区使用render
registerConfig.register({
  label: "文本",
  preview: () => "预览文本",
  render: () => "渲染文本",
  key: "text",
});
registerConfig.register({
  label: "按钮",
  preview: () => (
    <p><i-scale-to-original style="width:1em; height:1em;"></i-scale-to-original><span>按钮</span></p>),
  render: () => (<el-button>渲染按钮</el-button>),
  key: "button",
});
registerConfig.register({
  label: "输入框",
  preview: () => <ElButton type="primary" icon="el-icon-search">搜索</ElButton>,
  render: () => <ElInput placeholder='渲染输入框'>渲染输入框</ElInput>,
  key: "input",
});
